$(function () {
    share();
    var myLoading = new MyToast('.loadingToast', {content: '登录中...'});
    $('#loginBtn').click(function () {
        var username = $('input[name="username"]').val();
        var pwd = $('input[name="pwd"]').val();
        if (!username) {
            $.Dialog({content:'用户名不能为空！'})
        } else if (!pwd) {
            $.Dialog({content:'密码不能为空！'})
        } else {
            myLoading.show();
            $.ajax({
                url: host + '/CMSAPI/logPartner',
                data: {openid: openid, username: username, pwd: pwd},
                type: 'POST',
                dataType: 'JSON',
                success: function (data) {
                    myLoading.hide();
                    if (data.state) {
                        window.location.href = 'index.html';
                    } else {
                        $.Dialog({content:data.message});
                    }
                }
            })
        }
    })
});

